//
//  DevelopDetailTableViewCell.swift
//  HuaYun
//
//  Created by enghou on 2019/1/15.
//  Copyright © 2019 xyxorigation. All rights reserved.
//

import UIKit

class DevelopDetailTableViewCell: UITableViewCell {

    private var _model: JSON?
    
    @IBOutlet weak var titleLabel: UILabel!
    var model: JSON?{
        get{
            return _model
        }
        set{
            if _model != newValue {
                _model = newValue
                self.titleLabel.text = _model?["gsProjName"].string
                let planBudgetCost = (_model?["projBudget"].int ?? 0) / 1000000
                self.costPredicateLabel.text = String(planBudgetCost).rmbformat
                let planExecuteCost = (_model?["executeCost"].int ?? 0) / 1000000
                self.costExecuteLabel.text = String(planExecuteCost).rmbformat
                if let ratio = _model?["costImplementation"].double {
                    self.ratioLabel.text = String(format: "%.2f", ratio * 100) + "%"
                } else if let ratio = _model?["costImplementationRate"].double {
                    self.ratioLabel.text = String(format: "%.2f", ratio * 100) + "%"
                }
            }
        }
    }
    
    @IBOutlet weak var costPredicateLabel: UILabel!
    
    @IBOutlet weak var costExecuteLabel: UILabel!
    
    @IBOutlet weak var ratioLabel: UILabel!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
